package cn.gson.springboot.model.dao;

import org.springframework.data.jpa.repository.Query;
import org.springframework.data.repository.CrudRepository;

import com.alibaba.fastjson.JSONArray;

import cn.gson.springboot.model.pojos.User;

//用户DAO
public interface UserDAO extends CrudRepository<User,Integer>{

	//根据用户id查询用户实体对象
	@Query("select u from  User u where u.userId=?1")
	public User iduser(Integer userId);
	//根据用户id查询用户实体对象
		@Query("select u from  User u  join u.roles r where u.userName=?1 and u.userPwd=?2 and u.isdelete=1")
		public User cxyh(String userName,String userPwd);
		//根据用户id查询用户实体对象
		@Query("select u from  User u where u.userId=?1 and u.userPwd=?2")
		public User mmcxyh(int id,String userPwd);
		
		//根据用户身份证查询用户实体对象
				@Query("select u from  User u where u.userSfz=?1")
				public User pdcf(String phone);

}
